# Guile-zstd --- GNU Guile bindings to the zstd compression library.
# Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of Guile-zstd.
#
# Guile-zstd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# Guile-zstd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Guile-zstd.  If not, see <http://www.gnu.org/licenses/>.

nodist_noinst_SCRIPTS = pre-inst-env

EXTRA_DIST = zstd.scm guix.scm
SOURCES = zstd.scm zstd/config.scm
GOBJECTS = $(SOURCES:%.scm=%.go)

nobase_guilemodule_DATA = $(SOURCES)
nobase_guileobject_DATA = $(GOBJECTS)

# Make sure source files are installed first, so that the mtime of
# installed compiled files is greater than that of installed source
# files.  See
# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
# for details.
guile_install_go_files = install-nobase_guileobjectDATA
$(guile_install_go_files): install-nobase_guilemoduleDATA

GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
SUFFIXES = .scm .go
.scm.go:
	$(AM_V_GEN)$(top_builddir)/pre-inst-env $(GUILE_TOOLS) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<"

BUILT_SOURCES = zstd/config.scm

TESTS = tests/zstd.scm
EXTRA_DIST += $(TESTS) build-aux/test-driver.scm

TEST_EXTENSIONS = .scm
SCM_LOG_DRIVER =                                \
  $(top_builddir)/pre-inst-env                  \
  $(GUILE) --no-auto-compile -e main            \
      $(top_srcdir)/build-aux/test-driver.scm

AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)"

AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)"

CLEANFILES =					\
  $(GOBJECTS)					\
  $(TESTS:tests/%.scm=%.log)
